package ar.edu.unicen.exa.isistan.archassis.model.listeners.impl;

import java.util.List;

import org.eclipse.swt.custom.SashForm;

import ar.edu.unicen.exa.isistan.archassis.ia.api.db.JavaClass;
import ar.edu.unicen.exa.isistan.archassis.model.ModelManager;
import ar.edu.unicen.exa.isistan.archassis.model.listeners.IClassesListener;
import ar.edu.unicen.exa.isistan.archassis.view.cases.CasesComposite;
import ar.edu.unicen.exa.isistan.archassis.view.classes.HTMLClassComposite;

public class SashListener implements IClassesListener {
	private SashForm sashForm;
	private HTMLClassComposite classesComposite;
	private CasesComposite casesComposite;
	
	public SashListener(SashForm sashForm, HTMLClassComposite classesComposite, CasesComposite casesComposite) {
		this.sashForm = sashForm;
		this.classesComposite = classesComposite;
		this.casesComposite = casesComposite;
		ModelManager.getInstance().addClassesListener(this);
	}

	@Override
	public void change(List<JavaClass> classesList) {
		System.out.println("escuche");
		if (classesList == null) {
			sashForm.setMaximizedControl(this.classesComposite);
		} else {
			sashForm.setMaximizedControl(null);
		}

	}

}
